
package fire.eagle.android;

import android.preference.*;
import android.preference.Preference.OnPreferenceChangeListener;
import android.os.Bundle;
import java.util.*;

public class EditPreferencesActivity extends PreferenceActivity implements OnPreferenceChangeListener
{
	@Override
	public void onCreate(Bundle savedState)
	{
		super.onCreate(savedState);
		
		
		setPreferenceScreen(createPreferenceScreen());
	}
	
	protected PreferenceScreen createPreferenceScreen()
	{
		PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(this);
		
		List<Preference> prefs = Preferences.getUserVisiblePreferences(this);
		
		for (Preference pref : prefs)
		{
			pref.setOnPreferenceChangeListener(this);
			screen.addPreference(pref);
		}
		
		return screen;
	}
	
	
	public boolean onPreferenceChange(Preference preference,
			Object newValue)
	{
		Preferences.reload(this);
		BackgroundService.restart(EditPreferencesActivity.this);
		return true;
	}
}
